package lormi.meipin.common;



import org.apache.oltu.oauth2.as.issuer.MD5Generator;
import org.apache.oltu.oauth2.as.issuer.OAuthIssuer;
import org.apache.oltu.oauth2.as.issuer.OAuthIssuerImpl;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.springframework.web.bind.annotation.RestController;

import lormi.meipin.exception.LMException;

@RestController
public class LMOAuth2API {

    public static String getToken() throws LMException{

		//生成Access Token
		OAuthIssuer oauthIssuerImpl = new OAuthIssuerImpl(new MD5Generator());
		String accessToken;
		try {
			accessToken = oauthIssuerImpl.accessToken();
		} catch (OAuthSystemException e) {
			throw new LMException();
		}
		return accessToken;
    }
	
}
